home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11296 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  40 lines

  1. Path: red.weeg.uiowa.edu!robinson
  2. From: The Amorphous Mass <robinson@blue.weeg.uiowa.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! ANSI-C Date Access
  5. Date: Fri, 22 Mar 1996 18:12:59 -0600
  6. Organization: University of Iowa, Iowa City, IA, USA
  7. Distribution: world
  8. Message-ID: <Pine.A32.3.91.960322181207.49351A-100000@red.weeg.uiowa.edu>
  9. NNTP-Posting-Host: red.weeg.uiowa.edu
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=US-ASCII
  12. X-Sender: robinson@red.weeg.uiowa.edu
  13.  
  14. On 22 Mar 1996, David Rolfe wrote:
  15.  
  16. > Hello.
  17. >     Could someone tell me the ANSI-C method of accessing the
  18. > system date?  I've used _dos_getdate under the Borland C++ compiler
  19. > in DOS.  But I'd like to keep this version of my program ANSI-C
  20. > compatible.  E-Mail preferred,  Thanks.
  21.  
  22. #include <stdio.h>
  23. #include <time.h>
  24.  
  25. int main(void)
  26. {
  27.     time_t t;
  28.     time(&t);
  29.     printf("The system time is %s\n", ctime(&t));
  30.     return 0;
  31. }
  32.  
  33. /**James Robinson***********************            
  34.   "If a fatal error occurs, the program should not be allowed to continue."
  35.  -- Oracle Pro*C User's Guide         *************james-robinson@uiowa.edu**/
  36.  
  37.  
  38.  
  39.  
  40.